
public class e009 {
    public static void main(String[] args) {
	long sTime = System.currentTimeMillis();
        int s = 1000;
        int s2 = s / 2;
        double mLimit = Math.sqrt((double) s2) - 1;
        for (int m = 2; m < mLimit; m++) {
            if (s2 % m == 0) {
            int sm = s2 / m;
            while (sm % 2 == 0){
                sm /= 2;
            }
            int k = 0;
            if (m % 2 == 1) {
                k = m+ 2;
            } else {
                k = m + 1;
            }
            while (k < 2 * m && k <= sm) {
                if (sm % k == 0 && gcd(k, m) == 1) {
                    int d = s2 / (k * m);
                    int n = k - m;
                    int a = d *(m * m - n * n);
                    int b = 2 * d * m * n;
                    int c = d *(m * m + n * n);
                    System.out.println(a * b * c);
                    }
                k += 2;
                }
            }
        }
        long fTime = System.currentTimeMillis();
        System.out.println("Time: " + (fTime - sTime) + "ms");
    }

    static int gcd(int a, int b) {
        boolean found = false;
        int mod = a % b;
        while(true) {
            if (mod == 0) {
                return b;
            }
            int oldB = b;
            b = mod;
            mod = oldB % b;
        }
    }
}